﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" CodeFile="Details.aspx.cs" Inherits="AW_Dynamic_Data.Details" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true" />

    <h2>Entry from table <%= table.DisplayName %></h2>

    <asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy1" />

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
			<asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
				HeaderText="List of validation errors" />
			<asp:DynamicValidator runat="server" ID="DetailsViewValidator" ControlToValidate="DetailsView1" Display="None" />

			<br /><br />

			<asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="DetailsDataSource" OnItemDeleted="DetailsView1_ItemDeleted"
				CssClass="detailstable" FieldHeaderStyle-CssClass="bold" >
				
				<Fields>
					<asp:TemplateField>
						<ItemTemplate>
							<asp:HyperLink ID="EditHyperLink" runat="server"
								NavigateUrl='<%# table.GetActionPath(PageAction.Edit, GetDataItem()) %>'
								Text="Edit" />
							<asp:LinkButton ID="DeleteLinkButton" runat="server" CommandName="Delete" CausesValidation="false"
								OnClientClick='return confirm("Are you sure you want to delete this item?");'
								Text="Delete" />
						</ItemTemplate>
					</asp:TemplateField>
				</Fields>
			</asp:DetailsView>

			<llblgen:LLBLGenProDynamicDataSource runat="server" ID="DetailsDataSource" 
				DataContainerType="EntityCollection" CacheLocation="Session"
				EnableDelete="True" EnableInsert="True" EnableUpdate="True">
				<WhereParameters>
					<asp:DynamicQueryStringParameter />
				</WhereParameters>
			</llblgen:LLBLGenProDynamicDataSource>

			<br />

            <div class="bottomhyperlink">
                <asp:HyperLink ID="ListHyperLink" runat="server">Show all items</asp:HyperLink>
            </div>        
        </ContentTemplate>
    </asp:UpdatePanel>		    
</asp:Content>
